// $ANTLR 3.4 C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g 2012-11-09 14:56:43

package PL.prac8;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class XMLParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BARRA", "BLANCO", "CADENA", "COMENTARIO", "COMILLAS", "DIGITO", "EXCLAMACION", "GUIONES", "IGUAL", "LETRA", "MAYOR", "MENOR", "NUMERO", "PALABRA"
    };

    public static final int EOF=-1;
    public static final int BARRA=4;
    public static final int BLANCO=5;
    public static final int CADENA=6;
    public static final int COMENTARIO=7;
    public static final int COMILLAS=8;
    public static final int DIGITO=9;
    public static final int EXCLAMACION=10;
    public static final int GUIONES=11;
    public static final int IGUAL=12;
    public static final int LETRA=13;
    public static final int MAYOR=14;
    public static final int MENOR=15;
    public static final int NUMERO=16;
    public static final int PALABRA=17;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public XMLParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public XMLParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return XMLParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g"; }



    // $ANTLR start "entrada"
    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:12:1: entrada returns [boolean igual = true] : a= elemento EOF ;
    public final boolean entrada() throws RecognitionException {
        boolean igual =  true;


        boolean a =false;


        try {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:12:39: (a= elemento EOF )
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:12:41: a= elemento EOF
            {
            pushFollow(FOLLOW_elemento_in_entrada47);
            a=elemento();

            state._fsp--;


            if(!a) igual = false;

            match(input,EOF,FOLLOW_EOF_in_entrada50); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return igual;
    }
    // $ANTLR end "entrada"



    // $ANTLR start "elementos"
    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:13:1: elementos : ( elemento )* ;
    public final void elementos() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:13:10: ( ( elemento )* )
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:13:12: ( elemento )*
            {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:13:12: ( elemento )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==MENOR) ) {
                    int LA1_1 = input.LA(2);

                    if ( (LA1_1==PALABRA) ) {
                        alt1=1;
                    }


                }
                else if ( (LA1_0==CADENA||LA1_0==PALABRA) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:13:13: elemento
            	    {
            	    pushFollow(FOLLOW_elemento_in_elementos57);
            	    elemento();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "elementos"



    // $ANTLR start "elemento"
    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:14:1: elemento returns [boolean igual = true] : (a= apertura elementos b= cierre | PALABRA | CADENA );
    public final boolean elemento() throws RecognitionException {
        boolean igual =  true;


        String a =null;

        String b =null;


        try {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:14:40: (a= apertura elementos b= cierre | PALABRA | CADENA )
            int alt2=3;
            switch ( input.LA(1) ) {
            case MENOR:
                {
                alt2=1;
                }
                break;
            case PALABRA:
                {
                alt2=2;
                }
                break;
            case CADENA:
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;

            }

            switch (alt2) {
                case 1 :
                    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:14:42: a= apertura elementos b= cierre
                    {
                    pushFollow(FOLLOW_apertura_in_elemento71);
                    a=apertura();

                    state._fsp--;


                    pushFollow(FOLLOW_elementos_in_elemento73);
                    elementos();

                    state._fsp--;


                    pushFollow(FOLLOW_cierre_in_elemento77);
                    b=cierre();

                    state._fsp--;


                    if (!a.equals(b)){ igual = false;
                                                                                             System.out.println("Apertura: "+a+" y cierre: "+ b+ " no corresponden");}

                    }
                    break;
                case 2 :
                    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:16:42: PALABRA
                    {
                    match(input,PALABRA,FOLLOW_PALABRA_in_elemento124); 

                    }
                    break;
                case 3 :
                    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:16:50: CADENA
                    {
                    match(input,CADENA,FOLLOW_CADENA_in_elemento126); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return igual;
    }
    // $ANTLR end "elemento"



    // $ANTLR start "apertura"
    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:17:1: apertura returns [String salida = \"\"] : MENOR a= PALABRA MAYOR ;
    public final String apertura() throws RecognitionException {
        String salida =  "";


        Token a=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:17:38: ( MENOR a= PALABRA MAYOR )
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:17:40: MENOR a= PALABRA MAYOR
            {
            match(input,MENOR,FOLLOW_MENOR_in_apertura136); 

            a=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_apertura140); 

            match(input,MAYOR,FOLLOW_MAYOR_in_apertura142); 

            salida = a.getText();

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return salida;
    }
    // $ANTLR end "apertura"



    // $ANTLR start "cierre"
    // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:18:1: cierre returns [String salida = \"\"] : MENOR BARRA a= PALABRA MAYOR ;
    public final String cierre() throws RecognitionException {
        String salida =  "";


        Token a=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:18:36: ( MENOR BARRA a= PALABRA MAYOR )
            // C:\\Users\\Jose\\workspace\\prac8\\src\\main\\java\\PL\\prac8\\modulosantlr\\XMLParser.g:18:38: MENOR BARRA a= PALABRA MAYOR
            {
            match(input,MENOR,FOLLOW_MENOR_in_cierre154); 

            match(input,BARRA,FOLLOW_BARRA_in_cierre156); 

            a=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_cierre160); 

            match(input,MAYOR,FOLLOW_MAYOR_in_cierre162); 

            salida = a.getText();

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return salida;
    }
    // $ANTLR end "cierre"

    // Delegated rules


 

    public static final BitSet FOLLOW_elemento_in_entrada47 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_entrada50 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_elemento_in_elementos57 = new BitSet(new long[]{0x0000000000028042L});
    public static final BitSet FOLLOW_apertura_in_elemento71 = new BitSet(new long[]{0x0000000000028040L});
    public static final BitSet FOLLOW_elementos_in_elemento73 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_cierre_in_elemento77 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PALABRA_in_elemento124 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CADENA_in_elemento126 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MENOR_in_apertura136 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_PALABRA_in_apertura140 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_MAYOR_in_apertura142 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MENOR_in_cierre154 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_BARRA_in_cierre156 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_PALABRA_in_cierre160 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_MAYOR_in_cierre162 = new BitSet(new long[]{0x0000000000000002L});

}